package com.byb.server.service.mapper;

import com.byb.server.domain.*;
import com.byb.server.service.dto.WcProductDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity WcProduct and its DTO WcProductDTO.
 */
@Mapper(componentModel = "spring", uses = {WcIsurerMapper.class, WcInsuranceCategoryMapper.class, })
public interface WcProductMapper extends EntityMapper <WcProductDTO, WcProduct> {

    @Mapping(source = "wcIsurer.id", target = "wcIsurerId")
    @Mapping(source = "wcIsurer.name", target = "wcIsurerName")

    @Mapping(source = "wcInsuranceCategory.id", target = "wcInsuranceCategoryId")
    @Mapping(source = "wcInsuranceCategory.name", target = "wcInsuranceCategoryName")
    WcProductDTO toDto(WcProduct wcProduct); 

    @Mapping(source = "wcIsurerId", target = "wcIsurer")

    @Mapping(source = "wcInsuranceCategoryId", target = "wcInsuranceCategory")
    WcProduct toEntity(WcProductDTO wcProductDTO); 
    default WcProduct fromId(Long id) {
        if (id == null) {
            return null;
        }
        WcProduct wcProduct = new WcProduct();
        wcProduct.setId(id);
        return wcProduct;
    }
}
